package com.boge.modules.shop.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.boge.modules.shop.entity.GoodstypeEntity;
import com.boge.modules.shop.service.GoodstypeService;
import com.boge.common.utils.PageUtils;
import com.boge.common.utils.R;



/**
 * 
 *
 * @author boge
 * @email dengpbs@163.com
 * @date 2024-12-27 23:30:48
 */
@RestController
@RequestMapping("shop/goodstype")
public class GoodstypeController {
    @Autowired
    private GoodstypeService goodstypeService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("shop:goodstype:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = goodstypeService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions("shop:goodstype:info")
    public R info(@PathVariable("id") Integer id){
		GoodstypeEntity goodstype = goodstypeService.getById(id);

        return R.ok().put("goodstype", goodstype);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("shop:goodstype:save")
    public R save(@RequestBody GoodstypeEntity goodstype){
		goodstypeService.save(goodstype);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("shop:goodstype:update")
    public R update(@RequestBody GoodstypeEntity goodstype){
		goodstypeService.updateById(goodstype);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("shop:goodstype:delete")
    public R delete(@RequestBody Integer[] ids){
		goodstypeService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
